Two-dimensional models

Next we'll look at a common model of two populations. First, here's some code that will come in handy, for running simulations (run_sim_2d( ), much as before.

Species interactions

Let's generalize logistic-type population dynamics to more types. When there are $N$ individuals of type 0 and $M$ of type 1, then:

  1. Each time step, each type-0 individual has probability $p_0$ of dying, and producing a Poisson number of offspring.
  2. The mean number of offspring depends on the current amount of resources: it is equal to $\lambda_0 \exp(- (N + a_0 M)/K_0)$.
  3. Same, vice-versa.

Note: here death and reproduction are coupled, like for an annual plant.

How do we expect this to behave? Let's write down the expected dynamics: $$\begin{aligned} \mathbb{E}[N_{t+1} | N_t = N, M_t = M] &= F(N, M) \\ &= N (1 - p_0) + p_0 N \lambda_0 \exp(- (N + a_0 M)/K_0) \\ \mathbb{E}[M_{t+1} | N_t = N, M_t = M] &= G(N, M) \\ &= M (1 - p_1) + p_1 N \lambda_1 \exp(- (M + a_1 N)/K_1) . \end{aligned}$$

Aside: the Lotka-Volterra equations

The differential equations we'd get here are: $$\begin{aligned} \frac{dN}{dt} &= r_0 N_t \exp\left( - \frac{N_t + a_0 M_t}{K_0} \right) \\ \frac{dM}{dt} &= r_1 M_t \exp\left( - \frac{M_t + a_1 N_t}{K_1} \right) \end{aligned}$$ This is a multivariate version of the Ricker model; the more famous Lotka-Volterra equations are the "logistic" analogue, with $(1-N/K)$ instead of $\exp(-N/K)$.

Simulation

First, let's look at the time series of the two population sizes, both from a stochastic simulation and iteration of the deterministic equations. (If they don't look similar, we probably made a mistake.)

Equilibrium

Note that $\mathbb{E}[N_{t+1}] = N$ only if $\lambda_0 \exp(- (N + a_0 M)/K_0) = 1$, and this happens only if $(N + a_0 M)/K_0 = \log \lambda_0$.

Writing out the equations for both species, equilibrium occurs when $$\begin{aligned} N + a_0 M &= K_0 \log(\lambda_0) \\ a_1 N + M &= K_1 \log(\lambda_1) \end{aligned}$$ which is solved by $$\begin{aligned} N &= \frac{K_0 \log(\lambda_0) - a_0 K_1 \log(\lambda_1)}{1 - a_0 a_1} \\ M &= \frac{K_1 \log(\lambda_1) - a_1 K_0 \log(\lambda_0)}{1 - a_0 a_1} . \end{aligned}$$

Phase plots

We really want to think of the basic equations as telling us which way the system is "pushed". A nice way to view this is as a vector field of arrows in phase space. Here is code to make these plots. (But, you should probably look at the result, first!)

Here is a phase plot for this system, along with the deterministic trajectory starting from a single point, and converging to the equilibrium.

And, here is a stochastic simulation trajectory. (Run again to add more.)

Exercise

If $K_0 \log(\lambda_0) < a_0 K_1 \log(\lambda_1)$ and/or $K_1 \log(\lambda_1) < a_1 K_0 \log(\lambda_0)$ then there is no stable equilibrium with both species coexisting. Investigate with simulations to verify this, and explain intuitively why coexistence fails.

Homework

We can get very different behavior of this system for different values of $a_0$ and $a_1$. Here is a taxonomy:

a_0 a_1 interaction
- - mutualism
- 0 commensal
+ - parasitic
+ + competition

Plot simulation results in phase space of example parameters for each of the four interactions, both (a) with stable coexistence, and (b) without (where one goes extinct). Do you have any observations about where the transition occurs?

Isoclines

A nice way to look at phase plots is to draw on them the isoclines, i.e., the lines along which each variable does not change. We saw above that $N$ does not change if $$\begin{aligned} N + a_0 M &= K_0 \log(\lambda_0), \end{aligned}$$ and $M$ does not change if $$\begin{aligned} a_1 N + M &= K_1 \log(\lambda_1) . \end{aligned}$$ In this example these turn out to be straight lines in phase space.

Another set of parameters

Here's fun set of parameters.

Susceptible-Infected

The parameters are:

The equations for the number of susceptible ($S$) and the number of infected ($I$) individuals are: $$\begin{aligned} \frac{dS}{dt} &= \lambda - \mu S - a c S I + \rho I \\ \frac{dI}{dt} &= a c S I - \delta I - \rho I \end{aligned}$$

Alternative homework: Make a model

Design a stochastic version of this and simulate from it.